package cn.shop.dys.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;

import cn.shop.dys.R;
import cn.shop.dys.bean.UserAginstinfo;
import cn.shop.dys.dao.UserAgainstDao;
import cn.shop.dys.fragment.FourFragment;

/**
 * Created by zhouxiang on 2016/4/20.
 */
public class UserAgainstActivity extends Activity implements View.OnClickListener {

    private EditText et_evaluate;
    private UserAgainstDao dao;
    private EditText et_userinfo;
    private ImageView fanhui;
    private LinearLayout ll;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_userifo);
        et_userinfo = (EditText) findViewById(R.id.et_userinfo);
        et_evaluate = (EditText) findViewById(R.id.user_evaluate);
        fanhui = (ImageView) findViewById(R.id.bt_fanhui);
        ll = (LinearLayout) findViewById(R.id.ll);
        dao = new UserAgainstDao(this);
        fanhui.setOnClickListener(this);
        ll.setOnClickListener(this);


    }

    public void subit(View v) {
        String userinfo = et_userinfo.getText().toString().trim();
        String evaluate = et_evaluate.getText().toString().trim();
        if (TextUtils.isEmpty(userinfo) && TextUtils.isEmpty(evaluate)) {
            Toast toast = Toast.makeText(UserAgainstActivity.this, "您填的内容不完整", Toast.LENGTH_SHORT);
            toast.show();
        } else {
            UserAginstinfo info = new UserAginstinfo(userinfo, evaluate);
            dao.add(info);
            Toast toast = Toast.makeText(UserAgainstActivity.this, "您提交成功", Toast.LENGTH_SHORT);
            toast.show();
            finish();

        }

    }

    @Override
    public void onClick(View v) {
       finish();
    }
}
